<?php
/**
 * Created by PhpStorm.
 * User: pc
 * Date: 2018/8/10
 * Time: 11:43
 */
namespace app\index\model;

class Storeroom extends Common{
    protected $pk='sto_id';
    protected $tableName = 'storeroom';
    public function __construct(array $data = [])
    {
        parent::__construct($data);
    }
    //获取 档案上级信息
    public function getStoragePath($id,$s='>'){
        $data = $this->getDataByCondition(array('sto_id'=>$id));
        if(empty($data)){
            return false;
        }
        //查询档案盒上级档案柜
        $fdata = $this->getDataByCondition(array('sto_id'=>$data['patent_id']));
        if(empty($fdata)){
            return $data['sto_name'];
        }
        //查询档案柜上级库房
        $ffdata = $this->getDataByCondition(array('sto_id'=>$fdata['patent_id']));
        if(empty($ffdata)){
            return $fdata['sto_name'].$s.$data['sto_name'];
        }else{
            return $ffdata['sto_name'].$s.$fdata['sto_name'].$s.$data['sto_name'];
        }
    }


}